<template>
	<view class="news-detail">
		<view class="title">
			{{ newsDetail.title }}
		</view>
		<view class="content">
			{{ newsDetail.content }}
		</view>
	</view>
</template>

<script>
	import { GetNewsDetailById,AddMyLog } from '../../api/index.js'
	export default {
		data() {
			return {
				newsDetail:{}
				
			};
		},
		onLoad(options) {
			console.log(options,'options')
			this.getNewsDetailById(options.id)
		},
		methods:{
			async getNewsDetailById(id){
				const { data:res } = await GetNewsDetailById(id)
				console.log(res,'resdata')
				this.newsDetail = res.data[0]
				let paramsData = {
					nid:id,
					uid:JSON.parse(uni.getStorageSync('userinfo')).id,
					type:2
				}
				const {data:ress} = await AddMyLog(paramsData)
				console.log(ress,'r')
			}
		}
	}
</script>

<style lang="scss">
.news-detail{
	padding: 20rpx;
	.title{
		font-weight: bold;
		text-align: center;
	}
	.content{
		line-height: 56rpx;		
		padding-top: 30rpx;
	}
}
</style>
